import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_example/common/my_base_controller.dart';
import 'package:getx_example/get_connect/model/my_get_connect_model.dart';
import 'package:getx_example/get_connect/my_service/my_get_service.dart';

class MyGetConnectController extends MyBaseController {
  // 获取实例
  final MyGetConnectService contentService = Get.find<MyGetConnectService>();

  // 监听的model
  late MyGetConnectModel getConnectModel;

  RxInt count = 0.obs;
  var count1 = 0.obs;

  @override
  void onReady() {
    super.onReady();
    debugPrint('onReady');
  }

  getData() async {
    updateViewState(ViewState.loading);
    // 
    count++;
    getConnectModel = await contentService.getContent();
    updateViewState(ViewState.normal);

  }

  @override
  void onDetached() {
    debugPrint('onDetached');
  }

  @override
  void onInactive() {
    debugPrint('onInactive');
  }

  @override
  void onInit() {
    super.onInit();

    debugPrint('onInit');
  }

  @override
  void onHidden() {
    debugPrint('onHidden');
  }

  @override
  void onPaused() {
    debugPrint('onPaused');
  }

  @override
  void onResumed() {
    debugPrint('onResumed');
  }
}

class MyGetContentBuinding extends Bindings {
  @override
  void dependencies() {
    Get.lazyPut(() => MyGetConnectService());
    Get.lazyPut(() => MyGetConnectController());
  }
}
